<template>
    <div>
        <h3>childone --- childone --- childone</h3>
        <p>txt ===>{{txt}} </p>

        <p class="p" v-if="show">父组件控制我</p>

        <div>
            <slot>我是匿名插槽的默认内容</slot>
        </div>
        <div>
            <slot name="menu">这是menu的具名插槽</slot>
        </div>
    </div>
</template>

<script>
export default {
    props: ['txt'],
    data () {
        return {
            show:true
        }
    },
    methods: {
        changeshow(){
            this.show = !this.show
            console.log("show is change");
        }
    },
    mounted () {
        this.$bus.$on("changeshow",()=>{  // 通过 bus 接收childtwo 传来的方法,并规定如果修改
            this.show = !this.show
        })
    }
}
</script>

<style lang="css" scoped>
.p{
    width: 100px;
    height: 100px;
    background: brown;
    color: aliceblue;
}
    
</style>